<?php

/**
 * HisItem form base class.
 *
 * @method HisItem getObject() Returns the current form's model object
 *
 * @package    his
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BaseHisItemForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'              => new sfWidgetFormInputHidden(),
      'brand'           => new sfWidgetFormInputText(),
      'model_no'        => new sfWidgetFormInputText(),
      'serial_no'       => new sfWidgetFormInputText(),
      'category_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('HisCategory'), 'add_empty' => false)),
      'description'     => new sfWidgetFormInputText(),
      'historical_cost' => new sfWidgetFormInputText(),
      'date_purchased'  => new sfWidgetFormDate(),
      'owner_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('HisOwner'), 'add_empty' => false)),
      'token'           => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'              => new sfValidatorDoctrineChoice(array('model' => $this->getModelName(), 'column' => 'id', 'required' => false)),
      'brand'           => new sfValidatorString(array('max_length' => 255)),
      'model_no'        => new sfValidatorString(array('max_length' => 255)),
      'serial_no'       => new sfValidatorString(array('max_length' => 255)),
      'category_id'     => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('HisCategory'))),
      'description'     => new sfValidatorString(array('max_length' => 255)),
      'historical_cost' => new sfValidatorNumber(),
      'date_purchased'  => new sfValidatorDate(),
      'owner_id'        => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('HisOwner'))),
      'token'           => new sfValidatorString(array('max_length' => 255)),
    ));

    $this->widgetSchema->setNameFormat('his_item[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'HisItem';
  }

}
